package com.bitin.adorn.modules.transaction.domain;

import com.bitin.adorn.common.orm.domain.AbstractAuditableModel;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import lombok.*;

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Mr.Lu
 * @since 2024/8/22 15:18
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Entity
@Table(name = "payment")
public class Payment extends AbstractAuditableModel {
    /**
     * 开户名称
     */
    private String accountName;

    /**
     * 付款总金额
     */
    private BigDecimal totalAmount;
    /**
     * 分期信息
     */
    @OneToMany(orphanRemoval = true)
    @JoinColumn(name = "payment_id", referencedColumnName = "id")
    private Set<PaymentInstallment> installments = new HashSet<>();
}
